#include <iostream>

class Complex
{
public:
    Complex() : real(0), vir(0) {}
    Complex(int real, int vir) : real(real), vir(vir) {}
    Complex operator+(const Complex &p)
    {
        Complex result;
        result.real = this->real + p.real;
        result.vir = this->vir + p.vir;
        return result;
    }
    Complex operator-(const Complex &p)
    {
        Complex result;
        result.real = this->real - p.real;
        result.vir = this->vir - p.vir;
        return result;
    }
    // 占位参数
    //++a
    Complex &operator++()
    {
        real++;
        vir++;
        return *this;
    }
    // a++
    Complex operator++(int)
    {
        Complex result = *this;
        real++;
        vir++;
        return result;
    }

    friend std::ostream &operator<<(std::ostream &os, const Complex &c);
    friend std::istream &operator>>(std::istream &is, Complex &c);

private:
    int real; // 实部
    int vir;  // 虚部
};

// 不能作为成员函数重载:写法和一般习惯不同
// 全局重载
std::ostream &operator<<(std::ostream &os, const Complex &c)
{
    std::cout << c.real << "+" << c.vir << "i" << std::endl;
    return os;
}

std::istream &operator>>(std::istream &is, Complex &c)
{
    std::cin >> c.real;
    std::cin >> c.vir;
    return is;
}

int main()
{
    Complex c(1, 2);
    Complex c1(2, 3);
    Complex c2(3, 4);
    // Complex c2(2,3);
    // c.show();
    // c2.show();
    // Complex c1 = c + c2;
    // c1.show();
    // Complex c1 = c2 - c;
    // c1.show();

    // Complex c2 = c++;
    // c.show();
    // c2.show();

    // std::cout << c << c1 << c2;

    std::cin >> c;
    std::cout << c;
    return 0;
}

